<template>
  <div class="layout">
    <div class="layout-center">
      <div class="left">
        <div class="left-top">
          <div class="avatar">
            <img
              :src="
                userInfo.avatar
                  ? userInfo.avatar
                  : 'https://rs.dance365.com/default_head@3x.png?imageView2/0/w/200/h/1200/format/webp/ignore-error/1'
              "
            />
          </div>
          <div class="userName" v-if="userInfo.account">
            {{ userInfo.account }}
          </div>
          <div class="userName" v-else>游客</div>
          <div class="vipLevel">Lv.<span>99</span></div>
          <div class="other">
            <div class="attention">
              <div class="top">0</div>
              <div class="bottom">关注</div>
            </div>
            <div class="fans">
              <div class="top">0</div>
              <div class="bottom">粉丝</div>
            </div>
          </div>
        </div>
        <div class="nava">
          <router-link class="nava-item active" to="/mine/resource"
            >资源动态</router-link
          >
        </div>
        <ul class="nava">
          <li class="nava-item">
            <router-link to="/mine/vip">我的会员</router-link>
          </li>
          <li class="nava-item">
            <router-link to="/mine/wallet">我的钱包</router-link>
          </li>
          <li class="nava-item">
            <router-link to="/mine/coupons">我的优惠券</router-link>
          </li>
          <li class="nava-item">
            <router-link to="/mine/order">我买的订单</router-link>
          </li>

          <li class="nava-item" @click="changeManageStatus">
            <span class="item-left">我卖的</span>
            <span class="item-right">
              <el-icon v-show="!isDisplay">
                <ArrowRight />
              </el-icon>
              <el-icon v-show="isDisplay">
                <ArrowDown />
              </el-icon>
            </span>
          </li>
          <ul
            class="sale"
            :style="{ display: isDisplay ? 'inline-block' : 'none' }"
          >
            <li class="sale-item">
              <router-link to="/mine/orders_manager">订单管理</router-link>
            </li>
            <li class="sale-item">
              <router-link to="/mine/goods_manager">商品管理</router-link>
            </li>
            <li class="sale-item">
              <router-link to="/mine/customers_manager">客户管理</router-link>
            </li>
            <li class="sale-item">
              <router-link to="/mine/pending_payments_manager"
                >代收款</router-link
              >
            </li>
            <li class="sale-item">
              <router-link to="/mine/minePreferentialManagement">
                优惠管理</router-link
              >
            </li>
            <li class="sale-item">
              <router-link to="/mine/mineReviewsManagement"
                >评价管理</router-link
              >
            </li>
            <li class="sale-item">
              <router-link to="/mine/deposit">保证金</router-link>
            </li>
          </ul>
        </ul>
        <div class="nava">
          <router-link class="nava-item" to="/mine/information"
            >我的资料</router-link
          >
        </div>
      </div>
      <div class="right">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default {
  name: "mine",
};
</script>

<script setup lang="ts">
import { ref } from "vue";
import { ArrowRight, ArrowDown } from "@element-plus/icons-vue";
import { useUserInfoStore } from "@/stores/user/user";
import { storeToRefs } from "pinia";

const { userInfo } = storeToRefs(useUserInfoStore());
console.log(userInfo);

const isDisplay = ref<any>(false);

const changeManageStatus = () => {
  isDisplay.value = !isDisplay.value;
};
</script>

<style scoped lang="scss">
.layout {
  background-color: #f5f7f9;
  padding-top: 20px;
  .layout-center {
    width: 1200px;
    margin: auto;
    display: flex;
    padding-bottom: 60px;
    .left {
      width: 170px;
      margin-right: 10px;
      .left-top {
        margin-bottom: 10px;
        border-radius: 3px;
        background-color: white;
        padding: 21px 0;
        .avatar {
          width: 100px;
          margin: auto;
          border-radius: 50%;
          img {
            width: 100px;
            height: 100px;
            border-radius: 50%;
          }
        }
        .userName {
          font-size: 16px;
          text-align: center;
        }
        .vipLevel {
          width: 40px;
          height: 20px;
          background-color: #ff36b7;
          margin: 5px auto;
          border-radius: 3px;
          font-size: 10px;
          color: white;
          font-weight: 600;
          font-style: oblique;
          text-align: center;
          line-height: 20px;
        }
        .other {
          display: flex;
          justify-content: space-around;
          padding-top: 18px;
          .attention {
            .top {
              font-size: 16px;
              margin-bottom: 7px;
              text-align: center;
            }
            .bottom {
              color: #7d8090;
              font-size: 14px;
            }
          }
          .fans {
            .top {
              font-size: 16px;
              margin-bottom: 7px;
              text-align: center;
            }
            .bottom {
              color: #7d8090;
              font-size: 14px;
            }
          }
        }
      }
      .nava {
        padding: 5px 0;
        margin-bottom: 10px;
        border-radius: 3px;
        background-color: white;
        .nava-item {
          display: block;
          box-sizing: border-box;
          width: 170px;
          font-size: 14px;
          padding: 17px 21px;
          position: relative;
          &::before {
            // 这个content属性必须设置 可以为空
            content: "";
            width: 4px;
            height: 37px;
            background-color: #ff36b7;
            position: absolute;
            left: 0px;
            top: 7px;
            display: none;
          }
          &:hover {
            &::before {
              // 这个content属性必须设置 可以为空
              content: "";
              width: 4px;
              height: 37px;
              background-color: #ff36b7;
              position: absolute;
              left: 0px;
              top: 7px;
              display: inline-block;
            }
          }
          .active {
            &::before {
              // 这个content属性必须设置 可以为空
              content: "";
              width: 4px;
              height: 37px;
              background-color: #ff36b7;
              position: absolute;
              left: 0px;
              top: 7px;
              display: inline-block;
            }
          }
          .item-right {
            float: right;
          }
        }
        .sale {
          width: 100%;
          text-align: center;
          font-size: 14px;
          .sale-item {
            :deep(a) {
              display: block;
              padding: 12px 0px;
              &:hover {
                color: #f93684;
              }
            }
          }
        }
      }
    }
    .right {
      flex: 1;
    }
  }
  a {
    text-decoration: none;
    color: black;
  }
}
</style>
